<template>
	<div class="demo">
		<h2>我是Demo组件</h2>
		<h4>我有一台电脑:{{computer}}</h4>
		<button @click="gei">把电脑给我父亲</button>
	</div>
</template>

<script>
	export default {
		name:'Demo',
		data(){
			return {
				computer:'联想拯救者',
				x:900
			}
		},
		methods:{
			gei(){
				this.$emit('haha',this.computer)
			}
		},
		beforeDestroy(){
			this.$off('haha')
		}
	}
</script>

<style>
	.demo{
		background-color: orange;
		padding: 10px;
	}
</style>